<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!--  百度cdn引入jquery  -->
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
</head>
<body>
<form action="/users/login" method="psot">
    <input type="text" name="username"/>用户名<br>
    <input type="password" name="password"/>密码<br>
    <input type="text" name="kapchar"/>验证码<br>
    <img src="/captcha" style="width: 185px" id="cap"/>
    <input type="submit" value="登录"/>
</form>
<script>
    $(function () {
        $("#cap").click(function () {
            //让图片重新发送请求给验证码servlet
            $("#cap").attr('src', '/captcha?t=' + new Date().getTime());
        })
    })
</script>
</body>
</html>